﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" EnableEventValidation="false" AutoEventWireup="true" CodeFile="AddEditImage.aspx.cs" Inherits="AddEditImage" Title="Cungmuanao.com - Thêm / Cập nhật hình ảnh" %>
<%@ Register Assembly="FlashUpload" Namespace="FlashUpload" TagPrefix="FlashUpload" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Import Namespace="DTO" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="Server">

    <script type="text/javascript">
function SelectAllCheckboxes(spanChk)
 {
   // Added as ASPX uses SPAN for checkbox
   var oItem = spanChk.children;
   var theBox= (spanChk.type=="checkbox") ? spanChk : spanChk.children.item[0];
   xState=theBox.checked;
   elm=theBox.form.elements;

   for(i=0;i<elm.length;i++)
     if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
     {
       if(elm[i].checked!=xState)
         elm[i].click();
     }
 }
 </script>
<div class="title">
      <asp:Literal runat="server" ID="lblNewArticle" Text="Thêm tin mới" />
      <asp:Literal runat="server" ID="lblEditArticle" Text="Cập nhật tin" Visible="false" />
</div>
<div class="body">
   <p></p>
        <asp:LinkButton ID="LinkButton1" runat="server" 
            Visible="False">LinkButton</asp:LinkButton>
        <br />
    <FlashUpload:FlashUpload ID="flashUpload" runat="server" 
            UploadPage="Upload.cs" OnUploadComplete="UploadComplete()" 
            FileTypeDescription="Images" 
            FileTypes="*.*" 
            UploadFileSizeLimit="1800000" TotalUploadSizeLimit="10000000" />
    <P></P>
            <asp:Button ID="btDelete" runat="server" onclick="btDelete_Click" 
            Text="Xóa file đã chọn" />
            &nbsp;&nbsp;
            <asp:Button ID="btLoad" runat="server" onclick="btLoad_Click" 
            Text="Refresh" />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            BackColor="#CCCCCC" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
            CellPadding="2" Width="100%" ondatabound="GridView1_DataBound">
            <RowStyle ForeColor="#000066" />
            <Columns>
                <asp:TemplateField HeaderText="Chọn">
                    <HeaderTemplate>
                        <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                    </HeaderTemplate>                
                    <ItemTemplate>
                        <asp:CheckBox runat="server" ID="chkSelect" AutoPostBack="True" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>                     
                <asp:TemplateField HeaderText="Ảnh">
                    <ItemTemplate>
                        <asp:Image ID="imgFiles" runat="server" Height="50px" ImageUrl='<%# dirUrl + Eval("Name")%>' />
                    </ItemTemplate>
                </asp:TemplateField>                           
                <asp:TemplateField HeaderText="Tên file">
                    <ItemTemplate>
                        <asp:Label ID="lblTenfiles" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Độ lớn">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Length")+ " kb"  %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Right" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Loại file">
                    <ItemTemplate>
                        &nbsp;&nbsp;&nbsp;
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Extension") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        </asp:GridView>       
   <p></p>
</div>
<div class="bottom"></div>
</asp:Content>

